@extends('backstage.layout.master')
@section('title', '品牌认证列表')
@section('content')
    <style>
        .state li {
            list-style: none;
            float: left;
            padding: 0 20px;
            text-align: center;
            height: 40px;
            line-height: 40px;
        }

        .state li a:hover {
            color: #4D4DB3
        }

        .state li a {
            color: #668B8B;
            text-decoration: none;
            outline: none;
            blr: expression(this.onFocus=this.blur());
        }

        .curBg {
            background: #4D4DB3;
            height: 3px;
            position: absolute;
            width: 68px;
            left: 35px;
        }

        .cls {
            clear: both;
        }

        .state .cur a {
            color: #4D4DB3;
        }

        .detail {
            color: #00a6b3;
            cursor: pointer;
        }
    </style>

    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>

            <li class="active">
                <a href="backstage/authentication/brand-list">品牌认证列表</a>
            </li>
        </ul><!-- .breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
                {{--<span class="input-icon">--}}
                {{--<input type="text" placeholder="搜索..." class="nav-search-input"--}}
                {{--id="nav-search-input" autocomplete="off"/>--}}
                {{--<i class="icon-search nav-search-icon"></i>--}}
                {{--</span>--}}
            </form>
        </div><!-- #nav-search -->
    </div>

    <div class="page-content">
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="page-header">
                    <h1>
                        认证
                        <small>
                            <i class="icon-double-angle-right"></i>
                            品牌认证列表
                        </small>
                        <a href="backstage/authentication/limit-name-list" style="float: right"><button class="btn btn-success addKeyword">品牌名限制列表</button></a>
                    </h1>
                </div>
                <div class="state">
                    <ul>
                        @if(!isset($_GET['state']))
                            <li id="all" class="cur">
                                <a href="/backstage/authentication/brand-list">全部</a>
                            </li>
                        @else
                            <li id="all">
                                <a href="/backstage/authentication/brand-list">全部</a>
                            </li>
                        @endif
                        @if(isset($_GET['state'])&&$_GET['state']==0)
                            <li id="pending-review" class="cur">
                                <a href="/backstage/authentication/brand-list?state=0">待审核</a>
                            </li>
                        @else
                            <li id="pending-review">
                                <a href="/backstage/authentication/brand-list?state=0">待审核</a>
                            </li>
                        @endif
                        @if(isset($_GET['state'])&&$_GET['state']==1)
                            <li id="passed" class="cur">
                                <a href="/backstage/authentication/brand-list?state=1">已审核</a>
                            </li>
                        @else
                            <li id="passed">
                                <a href="/backstage/authentication/brand-list?state=1">已审核</a>
                            </li>
                        @endif
                        @if(isset($_GET['state'])&&$_GET['state']==2)
                            <li id="not-passed" class="cur">
                                <a href="/backstage/authentication/brand-list?state=2">未通过</a>
                            </li>
                        @else
                            <li id="not-passed">
                                <a href="/backstage/authentication/brand-list?state=2">未通过</a>
                            </li>
                        @endif
                        {{--@if(isset($_GET['state'])&&$_GET['state']==3)--}}
                        {{--<li id="commend" class="cur">--}}
                        {{--<a href="/backstage/authentication/brand-list?state=3">推荐</a>--}}
                        {{--</li>--}}
                        {{--@else--}}
                        {{--<li id="commend">--}}
                        {{--<a href="/backstage/authentication/brand-list?state=3">推荐</a>--}}
                        {{--</li>--}}
                        {{--@endif--}}

                    </ul>
                    <div class="curBg"></div>
                    <div class="cls"></div>
                </div>
                <div class="table-responsive">

                    <table id="sample-table-2" class="table table-striped table-bordered table-hover">

                        <thead>
                        <tr>
                            {{--<th class="center id">id</th>--}}
                            <th class="center">用户ID</th>
                            <th class="center">企业全称</th>
                            <th class="center">企业简称</th>
                            <th class="center">管理者</th>
                            <th class="center">职位</th>
                            <th class="center">状态</th>
                            <th class="center">首页LOGO</th>
                            {{--<th class="center">是否推荐</th>--}}
                            @if(isset($_GET['state'])&&$_GET['state']==1)
                                <th class="center">通过时间</th>
                            @else
                                <th class="center">申请时间</th>
                            @endif
                            <th class="center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($lists as $list)
                            <tr>
                                <td hidden="hidden" class="user">
                                    <input class="brand_authentication_id"
                                           value="{{ $list->brand_authentication_id}}" hidden="hidden">
                                </td>
                                <td class="center">{{ $list->user_id }}</td>
                                <td class="center">{{$list->company_name}}</td>
                                <td class="center">{{ $list->company_abbreviation }}</td>
                                <td class="center">{{$list->manager_name}}</td>
                                <td class="center">{{$list->job}}</td>
                                <td class="center">
                                    @if($list->state == 0)
                                        待审核
                                    @elseif($list->state == 1)
                                        已通过
                                    @elseif($list->state == 2)
                                        未通过
                                    @endif
                                </td>
                                <td class="center">
                                    @if($list->state == 0)
                                        <p>&nbsp;</p>
                                    @elseif($list->state == 1)
                                        @if($list->logo != null)
                                            <a href="backstage/authentication/update-logo?user_id={{$list->user_id}}"
                                               title="修改LOGO">
                                                <img src="{{asset('/images/'.$list->logo)}}" width="50px" height="50px">
                                            </a>
                                        @endif
                                    @elseif($list->state == 2)
                                        <p>&nbsp;</p>
                                    @endif
                                </td>
                                {{--<td class="center">--}}
                                {{--@if($list->is_commend == 1 && $list->state == 1)--}}
                                {{--<a href="backstage/authentication/cancel-brand?user_id={{$list->user_id}}">是</a>--}}
                                {{--@elseif($list->is_commend == 0 && $list->state == 1)--}}
                                {{--<a href="backstage/authentication/commend-brand?user_id={{$list->user_id}}">否</a>--}}
                                {{--@endif--}}
                                {{--</td>--}}
                                @if(isset($_GET['state'])&&$_GET['state']==1)
                                    <td class="center">
                                        {{ date('Y-m-d H:i:s',$list->pass_time) }}
                                    </td>
                                @else
                                    <td class="center">
                                        {{ date('Y-m-d H:i:s',$list->created_at) }}
                                    </td>
                                @endif
                                <td class="center">
                                    <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
                                        <a href="backstage/authentication/brand-detail?user_id={{$list->user_id}}"
                                           class="detail">查看详情</a>
                                    </div>
                                    @if($list->state == 1)
                                        <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons" style="margin-top: 3%">
                                            <a href="backstage/authentication/update-logo?user_id={{$list->user_id}}">
                                                修改首页LOGO
                                            </a>
                                        </div>
                                    @endif
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    <div class="row">
                        <div class="modal-footer no-margin-top">
                            <div class="dataTables_paginate paging_bootstrap">
                                <?php echo $lists->render(); ?>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
@section('script')
    <script type="text/javascript">
        $(function () {
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
        });

        $(document).ready(function () {
            var $liCur = $(".state ul li.cur"),
                    curP = $liCur.position().left,
                    curW = $liCur.outerWidth(true),
                    $slider = $(".curBg"),
                    $navBox = $(".state");
            $targetEle = $(".state ul li a"),
                    $slider.animate({
                        "left": curP,
                        "width": curW
                    });
            $targetEle.mouseenter(function () {
                var $_parent = $(this).parent(),
                        _width = $_parent.outerWidth(true),
                        posL = $_parent.position().left;
                $slider.stop(true, true).animate({
                    "left": posL,
                    "width": _width
                }, "fast");
            });
            $navBox.mouseleave(function (cur, wid) {
                cur = curP;
                wid = curW;
                $slider.stop(true, true).animate({
                    "left": cur,
                    "width": wid
                }, "fast");
            });
        });

    </script>
@stop